package com.fjnu.teaching;

import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * @desc:
 * @author: Ping
 * @date: 2025/9/19 9:35
 */

public class SpringIoCApp {

    public static void main(String[] args) {
        /**
         * 定义 IoC容器
         *
         *
         */

        ApplicationContext ctx = new ClassPathXmlApplicationContext(
                "annotation_based_applicationContext.xml");

        Teacher teacher = ctx.getBean(Teacher.class) ;
//        ApplicationContext ctx = new
//                ClassPathXmlApplicationContext(
//                        "applicationContext.xml");
//        /**
//         * 从容器中 获取 对应的beans
//         */
//        Teacher teacher_0 = ctx.getBean("teacher_0",
//                                         Teacher.class);
//        Teacher teacher_0_0 = ctx.getBean("teacher_0",
//                Teacher.class);
//
//        System.out.println(teacher_0 == teacher_0_0) ;

//        Course course = ctx.getBean("course", Course.class);
//
//        TeachingService teachingService = ctx.getBean("teachingService", TeachingService.class);
//        /**
//         * 业务操作
//         */
//        teachingService.startCourse(teacher_0, course);




    }
}
